package com.cmict.data.system.mq.producer.permission;

import com.cmict.data.framework.mq.core.RedisMQTemplate;
import com.cmict.data.system.mq.message.permission.RoleMenuRefreshMessage;
import com.cmict.data.system.mq.message.permission.UserRoleRefreshMessage;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Permission 权限相关消息的 Producer
 */
//@Component
//public class PermissionProducer extends AbstractBusProducer {
//
//    /**
//     * 发送 {@link RoleMenuRefreshMessage} 消息
//     */
//    public void sendRoleMenuRefreshMessage() {
//        publishEvent(new RoleMenuRefreshMessage(this, getBusId(), selfDestinationService()));
//    }
//
//    /**
//     * 发送 {@link UserRoleRefreshMessage} 消息
//     */
//    public void sendUserRoleRefreshMessage() {
//        publishEvent(new UserRoleRefreshMessage(this, getBusId(), selfDestinationService()));
//    }
//
//}

@Component
public class PermissionProducer {

    @Resource
    private RedisMQTemplate redisMQTemplate;

    /**
     * 发送 {@link RoleMenuRefreshMessage} 消息
     */
    public void sendRoleMenuRefreshMessage() {
        RoleMenuRefreshMessage message = new RoleMenuRefreshMessage();
        redisMQTemplate.send(message);
    }

    /**
     * 发送 {@link UserRoleRefreshMessage} 消息
     */
    public void sendUserRoleRefreshMessage() {
        UserRoleRefreshMessage message = new UserRoleRefreshMessage();
        redisMQTemplate.send(message);
    }

}